<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/DetailTemplate.master" Inherits="System.Web.Mvc.ViewPage<DotNetBurner.ProfileSettingsViewData>" %>
<%@ Import Namespace="DotNetBurner" %>
<%@ Import Namespace="System.Web.Mvc" %>
<%@ Import Namespace="Resources" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<div class="profile-info">
    <div style="float: left">
        <span class="user"><%=ViewData.Model.UserName%></span>
        <p><%=ViewData.Model.User.Email%></p>
    </div>
    <div style="float: right">
        <%=Html.Gravatar(ViewData.Model.User.Email, new RouteValueDictionary {{"size", 40}, {"d", "wavatar" }}, 
                                                    new Dictionary<string, object> {{"class", "gravatar"}})%>
    </div>
</div>
<div class="tab">
    <h2><%=Strings.ChangeEmail%></h2>
</div>    
<%using (Html.BeginForm("ChangeEmail", "User", FormMethod.Post, new { id = "changeemailform", onsubmit = "return changeEmailSubmit(this)" })) 
  {%>
    <%=Html.AntiForgeryToken("change-email")%>
    <p>
        <label for="email" class="label"><%=Strings.Email%>:</label>
        <%=Html.TextBox("email", ViewData.Model.User.Email, new { @class = "textBox" })%>
    </p>
    <div id="changeEmailErrors" class="errors"></div>
    <div id="changeEmailMessages" class="messages"></div>
    <p>
        <label class="label"></label>
        <input type="submit" value="<%=Strings.ChangeEmail%>" id="btnChangeMail" />
    </p>
<%} %>
<div class="tab" style="margin-top: 20px">
    <h2><%=Strings.ChangePass%></h2>
</div>    
<%using (Html.BeginForm("ChangePassword", "User", FormMethod.Post, new { id = "changepassform", onsubmit = "return changePasswordSubmit(this)" })) 
  {%>
    <%=Html.AntiForgeryToken("change-password")%>
    <p>
        <label for="currentPass" class="label"><%=Strings.CurrentPass%>:</label>
        <%=Html.Password("currentPass", "", new { @class = "textBox" })%>
    </p>
    <p>
        <label for="password" class="label"><%=Strings.NewPassword%>:</label>
        <%=Html.Password("password", "", new { @class = "textBox" })%>
    </p>
    <p>
        <label for="passwordConfirm" class="label"><%=Strings.Retype%>:</label>
        <%=Html.Password("passwordConfirm", "", new { @class = "textBox" })%>
    </p>
    <div id="changePasswordErrors" class="errors"></div>
    <div id="changePasswordMessages" class="messages"></div>
    <p>
        <label class="label"></label>
        <input type="submit" value="<%=Strings.ChangePass%>" id="btnChangePass" />
    </p>
<%} %>
<script type="text/javascript">
    function changeEmailSubmit(form) {
        formSubmit(form, '#changeEmailErrors', '#changeEmailMessages', '#btnChangeMail', '', '', '');
        return false;
    }

    function changePasswordSubmit(form) {
        formSubmit(form, '#changePasswordErrors', '#changePasswordMessages', '#btnChangePass', '', '', '');
        return false;
    }
</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeaderPlaceHolder" runat="server">
    <link href="<%=Html.Content("Profile.css")%>" rel="stylesheet" type="text/css" />
</asp:Content>
